﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace AramaruForest
{
    class Generator
    {
        

        public static Sprite GenerateHero(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\Hero.bmp", new Rectangle(new Point(0, 0), new Size(100, 48)), 4);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.OtherFrames.Add("Attack",new Bitmap(@"Data\Hero\Attack.bmp"));
            Item.OtherFrames.Add("Attack2", new Bitmap(@"Data\Hero\Attack2.bmp"));
            Item.OtherFrames.Add("Attack3", new Bitmap(@"Data\Hero\Attack3.bmp"));
            Item.OtherFrames.Add("Hurt", new Bitmap(@"Data\Hero\Hurt.bmp"));
            Item.Hero = true;

            return Item;
        }

        public static Sprite GenerateWizard(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Wizard\Hero.bmp", new Rectangle(new Point(0, 0), new Size(100, 48)), 4);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.OtherFrames.Add("Attack", new Bitmap(@"Data\Wizard\Attack.bmp"));
            Item.OtherFrames.Add("Attack2", new Bitmap(@"Data\Wizard\Attack2.bmp"));
            Item.OtherFrames.Add("Hurt", new Bitmap(@"Data\Wizard\Hurt.bmp"));

            return Item;
        }

        public static Sprite GenerateBlock(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Block.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;

            return Item;
        }

        

        public static Sprite GenerateLooseBlock(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Block.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.loose = true;

            return Item;
        }

        public static Sprite GenerateMonument(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Monument.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            if (_gameState._messageCount >= 0)
            {
                Item.message = _gameState._messages[_gameState._messageCount].Trim();
                if(_gameState._messageCount <= _gameState._messages.Count - 1)
                    _gameState._messageCount++;
            }

            return Item;
        }

        public static Sprite GenerateKunaiTrap(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\BlankTall.bmp", new Rectangle(new Point(0, 0), new Size(50, 300)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.trap = "kunai";
            

            return Item;
        }

        public static Sprite GenerateFallingBlockTrap(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Block.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.trap = "block";
            Item.Collider = true;


            return Item;
        }

        public static Sprite GenerateSpikesTrap(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Blank.bmp", new Rectangle(new Point(0, 0), new Size(40, 40)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.trap = "spikes";
            

            return Item;
        }

        public static Sprite GenerateSlowTrap(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\BlankLong.bmp", new Rectangle(new Point(0, 0), new Size(300, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.trap = "slow";
            

            return Item;
        }

        public static Sprite GenerateSpikes(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Spikes.bmp", new Rectangle(new Point(0, 0), new Size(20, 15)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.attack = 2;
            Item.Collider = true;

            return Item;
        }

        public static Sprite GeneratePotion1(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Potion1.bmp", new Rectangle(new Point(0, 0), new Size(20, 30)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.heals = 3;
            Item.gravity = true;

            return Item;
        }

        public static Sprite GenerateGround(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Ground.bmp", new Rectangle(new Point(0, 0), new Size(1000, 15)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;

            return Item;
        }

        public static Sprite GenerateHp(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hp.bmp", new Rectangle(new Point(0, 0), new Size(15, 28)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            

            return Item;
        }

        public static Sprite GenerateMana(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Mana.bmp", new Rectangle(new Point(0, 0), new Size(1, 28)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);


            return Item;
        }

        public static Sprite GenerateHpLabel(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\HpLabel.bmp", new Rectangle(new Point(0, 0), new Size(36, 28)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);


            return Item;
        }
        public static Sprite GenerateGoblin(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Goblin.bmp", new Rectangle(new Point(0, 0), new Size(52, 25)), 4);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.AI = 1;
            Item.attack = 1;

            return Item;
        }

        public static Sprite GeneratePhantom(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Phantom.bmp", new Rectangle(new Point(0, 0), new Size(92, 29)), 4);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = false;
            Item.AI = 3;
            Item.attack = 3;
            Item.Hp = 2;

            return Item;
        }

        public static Sprite GenerateOger(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Oger.bmp", new Rectangle(new Point(0, 0), new Size(34, 48)), 2);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.AI = 1;
            Item.attack = 3;
            Item.Hp = 3;

            return Item;
        }

        public static Sprite GenerateSorcerer(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Sorcerer.bmp", new Rectangle(new Point(0, 0), new Size(40, 49)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.AI = 4;
            Item.attack = 1;
            Item.Hp = 3;

            return Item;
        }

        public static Sprite GenerateSorcererBoss(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Sorcerer.bmp", new Rectangle(new Point(0, 0), new Size(40, 49)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.AI = 6;
            Item.attack = 5;
            Item.Hp = 10;

            return Item;
        }

        public static Sprite GenerateBird(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Bird.bmp", new Rectangle(new Point(0, 0), new Size(148, 29)), 4);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            
            Item.AI = 2;
            Item.attack = 2;

            return Item;
        }

        public static Sprite GenerateFireball(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Fireball.bmp", new Rectangle(new Point(0, 0), new Size(54, 53)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.attack = 2;
            Item.projectile = true;

            return Item;
        }

        public static Sprite GenerateAcid(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Acid.bmp", new Rectangle(new Point(0, 0), new Size(54, 53)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.attack = 3;
            Item.AI = 5;

            return Item;
        }

        public static Sprite GenerateFallingBlock(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Block.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.attack = 4;
            Item.projectile = true;
            Item.loose = true;
            

            return Item;
        }

        public static Sprite GenerateSword(GameState _gameState, int x, int y, bool flip)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\Sword.bmp", new Rectangle(new Point(0, 0), new Size(23, 10)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = false;
            Item.HeroItem = true;
            Item.Flip = flip;
            if (Item.Flip)
                Item.Location.X -= 47;
            Item.attack = 2;

            return Item;
        }

        public static Sprite GenerateKunai(GameState _gameState, int x, int y, bool flip)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\Kunai.bmp", new Rectangle(new Point(0, 0), new Size(20, 8)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = false;
            Item.Flip = flip;
            if (Item.Flip)
                Item.Location.X -= 53;
            Item.attack = 1;

            return Item;
        }

        public static Sprite GenerateUpKunai(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\KunaiUp.bmp", new Rectangle(new Point(0, 0), new Size(8, 20)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.DownFlip = true;

            Item.attack = 2;

            return Item;
        }
        public static Sprite GenerateDownKunai(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\KunaiDown.bmp", new Rectangle(new Point(0, 0), new Size(8, 20)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.DownFlip = true;

            Item.attack = 2;

            return Item;
        }

        public static Sprite GeneratePickUpKunai(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\Kunai.bmp", new Rectangle(new Point(0, 0), new Size(20, 8)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item._kunai = 3;

            return Item;
        }

        public static Sprite GenerateCaltrop(GameState _gameState, int x, int y, bool flip)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Hero\Caltrop.bmp", new Rectangle(new Point(0, 0), new Size(9, 9)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            Item.Collider = true;
            Item.gravity = true;
            Item.groundSurvives = true;
            Item.Flip = flip;
            if (Item.Flip)
                Item.Location.X += 13;
            else
                Item.Location.X -= 43;
            
            Item.attack = 1;

            return Item;
        }

        

        public static Sprite GenerateWin(GameState _gameState, int x, int y)
        {
            Sprite Item = new Sprite(_gameState, x, y, @"Data\Win.bmp", new Rectangle(new Point(0, 0), new Size(50, 50)), 1);
            Item.ColorKey = Color.FromArgb(75, 75, 75);
            
            Item.win = true;

            return Item;
        }
    }
}
